<template>
  <div class="app-wrapper">
    <Header />
    <div class="content-container">
      <main class="main-content">
        <router-view />
      </main>
      <Sidebar v-if="!$route.meta.hideSidebar" class="fixed-sidebar" />
    </div>
  </div>
</template>

<script setup>
import Header from '@/components/common/Header.vue'
import Sidebar from '@/components/common/Sidebar.vue'
</script>

<style scoped>
.app-wrapper {
  display: flex;
  flex-direction: column;
  /* min-height: 200vh; */
  margin-top: -80px;
}

/* 留言板页面专用样式 */
.app-wrapper .content-container[data-page="guestbook"] {
  margin: 0;
  padding: 0;
  max-width: 100%;
}

.content-container {
  display: flex;
  flex: 1;
  max-width: 1600px;
  margin-left: 100px; /* 左侧边距为视口宽度的10% */
  margin-right: auto; /* 右侧边距自动计算，使整体右偏 */
  width : 100%;
  padding: 20px 0;
  position: relative;
}

.main-content {
  flex: 1;
  margin-right: 200px; /* 为侧边栏留出空间 */
  padding:0 20px;
}

/* 侧边栏固定定位样式 */
.fixed-sidebar {
  position: absolute;
  top: 64px;
  right: -100px;
  width: 330px; /* 从300px增加到330px */
  z-index: 100;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .content-container {
    margin-left: 0;
    margin-right: 0;
  }
  
  .fixed-sidebar {
    right: 5%;
  }
}

@media (max-width: 1024px) {
  .content-container {
    flex-direction: column;
    margin-left: 20px;
    margin-right: 20px;
    padding: 20px 0;
  }
  
  .main-content {
    margin-right: 0;
    order: 1;
  }
  
  .fixed-sidebar {
    position: static;
    width: 100%;
    margin-top: 20px;
    order: 2;
  }
}
</style>